clear 
clear matrix
clear mata
set maxvar 20000

use   "${replication}\data\for_event_elecXroad.dta", clear

tab etime_elec, gen(etime_elec_)
tab etime_road, gen(etime_road_)
foreach var of varlist etime_*_* {
	replace `var'=0 if `var'==.
}

gen fd_elec=(year==year_elec)
gen fd_road=(year==year_road)
gen fd_both=fd_elec+fd_road


gegen group=group(year_elec year_road s_code)

*** Note this may take quite a lot of time to run
did_multiplegt_dyn icw_irrigation shrid_code year elecXroad ,  effects(6) placebo(3) trends_nonparam(s_code) controls(etime_elec_* etime_road_*) cluster(sd_code )
graph export "${replication}\output\cdh.png", replace
graph save "${replication}\output\cdh.gph", replace

graph use "${replication}\output\cdh.gph"